package com.yuntu.util;

import java.util.List;

public class PageUtil<T> {
	//5个属性
	private int pageIndex=1;//当前页码
	private int pageSize=5;//页面大小

	private int count = 0;  //总条数
	private int pageCount =0; //总页数
	private List<T> pageList;

	public int getPageIndex() {
		return pageIndex;
	}
	public void setPageIndex(int pageIndex) {
		this.pageIndex = pageIndex;
	}
	public int getPageSize() {
		return pageSize;
	}
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}
	public int getCount() {
		return count;
	}
	public void setCount(int count) {
		this.count = count;
		if(count>0){//确保有数据
			if(count%pageSize==0){//判断是否整除
				pageCount=count/pageSize;//总页数=总数/页大小
			}else{
				pageCount=(count/pageSize)+1;//总页数=总数/页大小+1
			}
		}
	}
	public int getPageCount() {
		return pageCount;
	}
	public void setPageCount(int pageCount) {
		this.pageCount = pageCount;
	}
	public List<T> getPageList() {
		return pageList;
	}
	public void setPageList(List<T> pageList) {
		this.pageList = pageList;
	}

	@Override
	public String toString() {
		return "PageUtil{" +
				"pageIndex=" + pageIndex +
				", pageSize=" + pageSize +
				", count=" + count +
				", pageCount=" + pageCount +
				", pageList=" + pageList +
				'}';
	}
}
